var obj = new URLSearchParams(location.search);
var categoryId = obj.get('categoryId');
console.log(categoryId);

$.ajax({
    type: 'get',
    url: `/posts/category/` + categoryId,
    success: function(response) {
        var html = template('listTpl', { data: response });
        $('#listBox').html(html);
        $('#title').text(response[0].category.title);
    }
});
function formDate(date) {
    var date = new Date(date);
    return `${date.getFullYear()}年${date.getMonth() +
        1}月${date.getDate()}日${date.getHours()}时${date.getMinutes()}分${date.getSeconds()}秒`;
}
